<template>
  <el-select v-model="basicdataPart" placeholder="请选择装置部件" style="width:100%;" v-loading = 'isOneDropDownBoxLoading' :disabled=isOneDropDownBoxLoading>
   <el-option v-for="basicdataPart in partsData" :key="basicdataPart.fileCode" :label="'[' + basicdataPart.fileCode + ']' + basicdataPart.fileDevicename" :value="basicdataPart.fileCode" ></el-option>
  </el-select>
</template>

<script>
  export default {
    data () {
      return {
        partDeviceId: '', //传入的id值
        basicdataPart: '', //四级下拉框值
        partsData: [], // 请求的四级数据
        isOneDropDownBoxLoading: false // 数据刷新是否触发
      }
      },
   watch: {
    partDeviceId (newVal, oldVal) {
      this.getNextNode(newVal)
    }
      },
   methods: {
    // 获取四级数据
    getNextNode (presentNode) {
      this.isOneDropDownBoxLoading = true
      this.$http({
        url: `/basicdata/basictree/partDevice/nextLevelTreeData`,
        method: 'get',
        params: {
          id: presentNode
        }
      }).then(({ data }) => {
        this.partsData = data.data
        this.$emit('dataOutGoing', this.basicdataPart)
        this.isOneDropDownBoxLoading = false
      })
    }
   }
      }
</script>

<style>
</style>
